<?php
namespace app\admin\logic\mqlogic;

use app\admin\logic\ImportMoney;
use app\admin\logic\RateService;
use app\admin\logic\Transfer;
use app\common\library\rabitmq\MqConsumerObject;
use FSLock\FSLock;
use think\exception\ValidateException;
use think\Log;

//处理导入众包费
class RateExportConsumer extends MqConsumerObject
{
    public function __construct(array $config)
    {
        parent::__construct($config);
    }

    //消费者处理类
    public function run($message)
    {
        $message = json_decode($message, true);
        $where = $message['where'];  //where条件
        $timeStr = $message['timeStr']; //时间戳
        $company_id = $message['company_id']; //公司ID
        try {
            RateService::instance()->export($where, $timeStr, $company_id);
        }catch (\Exception $e) {
            $msg = $e->getMessage();
            doLog($msg, 'exportlog');
        }

        return true;
    }

    public function __destruct()
    {
        parent::__destruct();
    }

}